﻿using LoongCAD.STC.Friendly.Dialog;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CustonDemo
{
    public partial class Form_PluginMain : PluginFormBase
    {
        public Form_PluginMain()
        {
            InitializeComponent();
            InitControls();
        }

        void InitControls()
        {
            weldIsCreate.ButtonLabels = new string[] { "是", "否" };
            weldIsCreate.ButtonKeys = new int[] { 1, 0 };
            weldIsCreate.RefreshLayout();
            weldIsCreate.Value = 1;
        }

        protected override string LoadValuesPath(string fileName)
        {
            //设置默认值
            StructuresData data = new StructuresData();
            SetAttributeValue(webProps, data.webProps);
            SetAttributeValue(flgProps, data.flgProps);
            SetAttributeValue(weldIsCreate, data.weldIsCreate);

            string Result = base.LoadValuesPath(fileName);
            Apply();
            return Result;
        }


        //=================上方按钮回调=====================
        //读取按钮回调
        private void saveLoad1_AttributesLoadClicked(object sender, EventArgs e)
        {
            this.LoadValues(this.saveLoad1.SaveLoadText);
        }
        //另存为按钮回调
        private void saveLoad1_AttributesSaveAsClicked(object sender, EventArgs e)
        {
            this.SaveValues(this.saveLoad1.SaveAsText);
        }
        //保存按钮回调
        private void saveLoad1_AttributesSaveClicked(object sender, EventArgs e)
        {
            this.SaveValues(this.saveLoad1.SaveLoadText);
        }

        //=============下方按钮回调=================
        //应用按钮回调
        private void okApplyModifyGetOnOffCancel1_ApplyClicked(object sender, EventArgs e)
        {
            this.Apply();
        }
        //取消按钮回调
        private void okApplyModifyGetOnOffCancel1_CancelClicked(object sender, EventArgs e)
        {
            this.Close();
        }
        //获取按钮回调
        private void okApplyModifyGetOnOffCancel1_GetClicked(object sender, EventArgs e)
        {
            this.Get();
        }
        //修改按钮回调
        private void okApplyModifyGetOnOffCancel1_ModifyClicked(object sender, EventArgs e)
        {
            this.Modify();
        }
        //确认按钮回调
        private void okApplyModifyGetOnOffCancel1_OkClicked(object sender, EventArgs e)
        {
            this.Apply();
            this.Close();
        }
        //打勾选项框回调
        private void okApplyModifyGetOnOffCancel1_OnOffClicked(object sender, EventArgs e)
        {
            this.ToggleSelection();
        }
    }
}
